//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "ioc\pveh.sqf"
#include <core_macros.h>

TRACE_1("Start",_this);

private ["_var","_value","_idx","_namespace","_target","_event","_origin"];
DEFAULT_PARAM(_var,0,"");
DEFAULT_PARAM(_value,1,[]);
DEFAULT_PARAM(_origin,2,"");

_idx = GVAR(NAMESPACE_PVEH) find toLower(_var);
if (_idx >= 0) then {
	_namespace = GETVAL(_value,0,"");
	_event = GETVAL(_value,1,"");
	_target = GETVAL(_value,3,"");
	INFO_1("Info",ARR_4(_namespace,_event,_target,_origin));
	if (_target call FUNC(locality)) then {
		if (toLower(_namespace) == (GVAR(NAMESPACES) select _idx)) then {
			_value call FUNC(exec);
		} else {
			DEBUG_1("Invalid Namespace for PVEH",_namespace);
		};
	};
} else {
	DEBUG_1("Invalid Namespace PVEH",_this);
};

TRACE("End");